Absolute to relative URL converter fix

James Peret 8 years ago
parent
commit
7842eca16c

BIN
app/content/imgs/notebook-icon.png


+ 4 - 0
app/index.html

@@ -11,6 +11,7 @@
11 11
 
12 12
 
13 13
     <!-- Javascript -->
14
+    <script src="../bower_components/isotope/dist/isotope.pkgd.js"></script>
14 15
     <script src="../bower_components/jquery/dist/jquery.js"></script>
15 16
     <script src="../bower_components/ace-builds/src-min-noconflict/ace.js"></script>
16 17
     <script src="../bower_components/angular/angular.js"></script>
@@ -18,6 +19,7 @@
18 19
     <script src="../bower_components/angular-sanitize/angular-sanitize.js"></script>
19 20
     <script src="../bower_components/angular-ui-ace/ui-ace.js"></script>
20 21
     <script src="../bower_components/angular-highlightjs/src/angular-highlightjs.js"></script>
22
+
21 23
     <script src="scripts/highlight.pack.js"></script>
22 24
 
23 25
     <script src="scripts/codex-app.js"></script>
@@ -31,6 +33,8 @@
31 33
     <script src="scripts/services/prefs-service.js"></script>
32 34
     <script src="scripts/services/date-formatter.js" charset="utf-8"></script>
33 35
 
36
+
37
+
34 38
     <script>
35 39
       var remote = require('remote');
36 40
       var ipc = require('ipc');

+ 1 - 1
app/scripts/controllers/app-ctrl.js

@@ -135,7 +135,7 @@ angular.module('codexApp.index', [])
135 135
     }
136 136
 
137 137
     $scope.getImageURL = function(img_url) {
138
-      return "../codex/" + FileService.absoluteToRelativeURL(FileService.getNotesDir(), img_url)
138
+      return "" + FileService.absoluteToRelativeURL(FileService.getNotesDir(), img_url)
139 139
     }
140 140
 
141 141
   }]);

+ 7 - 2
app/scripts/services/file-service.js

@@ -274,6 +274,7 @@ angular.module('codexApp')
274 274
     // split urls and create arrays
275 275
     var current_path = current_url.split('/');
276 276
     var absolute_path = getUrlParts(absolute_url).pathname.split('/');
277
+    var root_path = getUrlParts(notes_dir).pathname.split('/');
277 278
     // remove the current note's filename from the url and the image filename from the url
278 279
     //current_path.pop();
279 280
     current_path.shift();
@@ -288,9 +289,13 @@ angular.module('codexApp')
288 289
     for (var i = 0; i < absolute_path.length; i++) {
289 290
       absolute_path_count = absolute_path_count + 1;
290 291
     }
291
-    absolute_path_count = absolute_path_count - 3;
292
+    var root_path_count = 0;
293
+    for (var i = 0; i < root_path.length; i++) {
294
+      root_path_count = root_path_count + 1;
295
+    }
296
+    var count = current_path_count - root_path_count;
292 297
     //dif = current_path_count - (absolute_path_count -1);
293
-    for (var i = 0; i < absolute_path_count; i++) {
298
+    for (var i = 0; i < count; i++) {
294 299
       absolute_path.shift();
295 300
     }
296 301
     // make the relative path a string again

+ 3 - 1
bower.json

@@ -25,6 +25,8 @@
25 25
     "angular-sanitize": "~1.4.7",
26 26
     "angular-ui-ace": "~0.2.3",
27 27
     "jquery": "~2.1.4",
28
-    "angular-highlightjs": "~0.4.3"
28
+    "angular-highlightjs": "~0.4.3",
29
+    "angular-isotope": "~0.1.14",
30
+    "isotope": "~2.2.2"
29 31
   }
30 32
 }

+ 1 - 0
codex/dev/codex-app/notes.md

@@ -8,6 +8,7 @@ Links, snipets and references for the Codex App.
8 8
 * [Packery](http://packery.metafizzy.co/) - The bin-packing layout library
9 9
 * [Mansonary](http://masonry.desandro.com/) - Cascading grid layout library
10 10
 * [Wavesurfer.js](http://wavesurfer-js.org/) - Web Audio Waveform Visualizer
11
+* [Cheerio](https://github.com/cheeriojs/cheerio) - Fast, flexible, and lean implementation of core jQuery designed specifically for the server
11 12
 
12 13
 ## List folder and files
13 14
 

+ 1 - 0
package.json

@@ -27,6 +27,7 @@
27 27
   },
28 28
   "devDependencies": {
29 29
     "bower": "^1.6.3",
30
+    "cheerio": "^0.19.0",
30 31
     "electron-packager": "^5.0.0",
31 32
     "electron-prebuilt": "^0.33.3",
32 33
     "electron-rebuild": "^1.0.1",